package factory.store.impl;

import factory.NYPizzaIngredientFactory;
import factory.PizzaIngredientFactory;
import factory.pizza.*;
import factory.pizza.impl.CheesePizza;
import factory.pizza.impl.ClamPizza;
import factory.pizza.impl.PepperoniPizza;
import factory.pizza.impl.VeggiePizza;
import factory.store.PizzaStore;

/**
 * 纽约披萨店
 */
public class NYPizzaStore extends PizzaStore {
    @Override
    protected Pizza createPizza(String type) { // 创建披萨用的是 普通工厂
        Pizza pizza = null;
        // 原料创建用的是 抽象工厂
        PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

        if (type.equals("cheese")) {
            pizza = new CheesePizza(ingredientFactory);
            pizza.setName("New York Style Cheese Pizza");
        } else if (type.equals("veggie")) {
            pizza = new VeggiePizza(ingredientFactory);
            pizza.setName("New York Style Veggie Pizza");
        } else if (type.equals("clam")) {
            pizza = new ClamPizza(ingredientFactory);
            pizza.setName("New York Style Clam Pizza");
        } else if (type.equals("pepperoni")) {
            pizza = new PepperoniPizza(ingredientFactory);
            pizza.setName("New York Style Pepperoni Pizza");

        }
        return pizza;
    }
}
